import os

from ffpp.abnormal.abnormal_mean_statistics import videos_mean
from option import parse_args


def main():
    args = parse_args()
    fake_type, version = args.fake_type, args.compression_version
    # original_crops = os.path.join(args.root_dir, 'original_sequences', 'youtube', 'c23', 'crops')
    fake_diffs = os.path.join(args.root_dir, 'manipulated_sequences', args.fake_type, version, 'diffs')
    args.save = True
    if args.save:
        with open(f'abnormal_mean_statistics_{fake_type}_{version}.dat', 'w') as f:
            videos_mean(fake_diffs, f.write, '{},{:.2f},{:.2f},{},{}\n', args,
                        mask_lower_threshold=10., mask_upper_threshold=50.)
    else:
        videos_mean(fake_diffs, print, '{},{:.2f},{:.2f},{},{}', args,
                    mask_lower_threshold=10., mask_upper_threshold=50.)


if __name__ == '__main__':
    main()
